<template>
    <div class="app-container">
        <el-card class="box-card" shadow="always" v-show="showSearch">
            <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px" @submit.native.prevent>
                    <el-form-item label="快递名称" prop="peisongCompany">
                        <el-input v-model="queryParams.peisongCompany" placeholder="请输入快递名称" clearable @keyup.enter="handleQuery" />
                    </el-form-item>
                    <el-form-item label="联系电话" prop="telephone">
                        <el-input v-model="queryParams.telephone" placeholder="请输入联系电话" clearable @keyup.enter="handleQuery" />
                    </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="handleQuery">搜索</el-button>
                    <el-button @click="resetQuery">重置</el-button>
                </el-form-item>
            </el-form>
        </el-card>

        <el-card shadow="always" :body-style="{ padding: '20px' }" style="margin-top: 10px;">
            <el-row :gutter="10" class="mb8">
                <el-col :span="1.5">
                    <el-button type="primary" @click="handleAdd" v-hasPermi="['order:logisticsCompany:add']">添加
                    </el-button>
                </el-col>
                <el-col :span="1.5">
                    <el-button type="danger" :disabled="!multiple" @click="handleBatchDelete"
                        v-hasPermi="['order:logisticsCompany:remove']">删除
                    </el-button>
                </el-col>
                <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
            </el-row>

            <el-table v-loading="loading" :data="dataSource" @selection-change="handleSelectionChange" size="large">
                <el-table-column type="selection" width="55" align="center" :selectable="selectHandle" />
                <el-table-column label="序号" type="index" width="60"> </el-table-column>
                <el-table-column label="联系电话" align="center" prop="telephone"  />
                <el-table-column label="物流公司" align="center" prop="peisongCompany" >
                    <!-- <template #default="scope">
                        <el-tag>{{ selectDictLabel(logistics_company, scope.row.peisongCompany) }}</el-tag>
                    </template> -->
                </el-table-column>
                    <el-table-column label="物流描述" align="center" prop="remark" />
                            <el-table-column label="提醒天数" align="center" prop="warningDay" />
                <el-table-column label="状态" align="center" prop="brandStatus">
                    <template #default="scope">
                        <el-switch @change="statusChange($event,scope.row)" v-model="scope.row.status" active-value="0" inactive-value="1" />
                    </template>

                </el-table-column>
                <el-table-column label="操作" align="center" fixed="right">
                    <template #default="scope">
                        <el-button type="text"  @click="handleEdit(scope.row)" v-hasPermi="['order:ordersReturn:edit']">编辑</el-button>
                        <el-divider direction="vertical"></el-divider>
                        <el-button type="text"  @click="handleDelete(scope.row.id)" v-hasPermi="['order:ordersReturn:remove']">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <pagination v-show="total > 0" :total="total" v-model:page.sync="queryParams.pageNum"
                v-model:limit.sync="queryParams.pageSize" @pagination="getList" />
        </el-card>
        <addForm ref="modelForm" @ok="getList"></addForm>
    </div>
</template>
  
<script>
import addForm from './modules/addForm.vue';
import listMixin from '@/mixins/listMixin';
import { updateLogisticsCompany  } from '@/api/goods/logisticsCompany';
export default {
    name: "tips",
    components: {
        addForm
    },
    mixins: [listMixin],
    data() {
        return {
            logistics_company:[],
            queryParams: {
                orderNo: '',
                pageNum: 1,
                pageSize: 10
            },
            urls: {
                list: '/order/logisticsCompany/list',
                delete: '/order/logisticsCompany',
            },
        };
    },
    mounted() {
        this.getDicts(['logistics_company']);
    },
    methods: {
        statusChange(value,row) {
            updateLogisticsCompany(row).then(res => {
                this.$modal.msgSuccess('修改成功');
            });
        }
    },
};
</script>
  